import toLocalDate from './to-local-date'

/**
 *
 * @param {String} dateStr 表示UTC时间的字符串
 * @return {Date} Date对象
 */
export default function (dateStr) {
  let date = toLocalDate(dateStr)

  if (!date) {
    return date
  }

  let offset = (new Date()).getTimezoneOffset()

  return new Date(date.getTime + offset * 60 * 1000)
}
